1. Field of the Invention
This invention relates to dynamic brokering of messages between objects implemented using like or different object models.
2. Background
Object-oriented programming is a method of creating computer programs by combining certain fundamental building blocks, and creating relationships among and between the building blocks. The building blocks in object-oriented programming systems are called “objects.” An object is a programming unit that groups together a data structure (instance variables) and the operations (methods) that can use or affect that data. Thus, an object consists of data and one or more operations or procedures that can be performed on that data. The joining of data and operations into a unitary building block is called “encapsulation.” In object-oriented programming, operations that can be performed on the data are referred to as “methods.”
An object-oriented software application uses objects to define its data and the methods that operate on the data. An object communicates with another object via messages. For example, when one object needs to manipulate data that resides in another object or needs to execute computation methods in another object, it sends a message. The requesting object identifies the desired manipulation operation by specifying a method. The requesting object can further send arguments that can be used by the second object in performing the named method. The servicing object performs the method requested in the message. The data provided by the requesting object can be used to perform the requesting operation. In client/server terminology, the requesting object is called the client object and the servicing object is called the server object.
When the client and server objects are running in the same computer and operating system or in the same process or memory address space, the program or system can use its own mechanisms for messaging and object identification without regard for any other systems. The physical location of the objects is determined, known, and maintained by the single system. In a distributed environment, however, objects can reside on different systems and across networks, for example. Thus, in a distributed environment, a client object may need the services of a server object that resides on a remote system. Not all object models provide for such remote requests. Also, the remote system may use an object messaging mechanism that is incompatible with the client object's messaging mechanism. In that case, the client object and server object cannot communicate or “interoperate”.”
An object model provides a mechanism for communication, or messaging, between objects within the model. The mechanism includes a protocol that defines the method of communication. Examples of object models include the NeXT object model, Microsoft's Object Linking and Embedding/Common Object Model (OLE/COM), SunSoft's Distributed Object Environment (DOE), and Smalltalk. To facilitate communication, an object model can use an object bus, or an Object Request Broker (ORB). An ORB allows objects to make requests of, and receive responses from, other objects. Examples of ORBs include CORBA (defined by Object Management Group), SOM from IBM, ORB Plus from HP, ObjectBroker from Digital Equipment Corporation, and Orbix from Iona.
An ORB uses an Interface Definition Language (IDL) to define static interfaces between objects. For example, an interface defines the methods and properties, or arguments, for each object. An interface file written in IDL is compiled to generate client and server language-specific stubs such as C, C++, Objective-C, etc. These stubs must be compiled into both the client and the server before any communication can take place.
These language-specific stubs define how clients invoke corresponding services on the servers. From a client's perspective, the stub acts like a local call. The stub is a local proxy for the remote server object. The stub includes code to encode and decode an operation and its parameters into a compacted message format that can be sent to the server. This is referred to as marshaling. Several ORBs, including the CORBA ORB, are described in detail in R. Orfali et al., “The Essential Distributed Objects Survival Guide” (New York: John Wiley & Sons, 1996).
In addition to the language-specific stubs, CORBA provides some application program interfaces (APIs) on the client-side to facilitate object communication. A Dynamic Invocation Interface provides APIs that can be used to look up the metadata that defines the server interface, generate message parameters, issue a remote call, and receive results from the call. An Interface Repository is a run-time database that contains machine-readable versions of the IDL-defined interfaces. The APIs associated with the Interface Repository provide mechanisms for retrieving, storing and updating the metadata information contained in the Interface Repository. The ORB Interface includes APIs to convert an object reference (i.e., a unique name or identifier associated with an object) to a string.
Like the client side, the server side includes IDL stubs, or server stubs. A server stub is also referred to as a skeleton. Like a client stub, a server stub is defined using IDL and created using an IDL compiler. A server stub provides a static interface to a service provided, or exported, by a server. It calls the method on the server identified by the client. On the server side, CORBA provides functionality to aid in servicing a request.
A Dynamic Skeleton Interface provides a run-time binding mechanism to handle incoming method calls directed to a server that does not have a server stub. An object adapter provides the run-time environment for instantiating a server object, assigning an object reference to a server object, and passing it a request. An Implementation Repository is a run-time repository that identifies the classes a server supports, the objects that are instantiated, and the instantiated objects' object references. Administrative data such as trace information can also be stored in the Implementation Repository. The server side includes an ORB Interface that is the same as that used on the client side
Existing object models such as the ones identified above do not provide a means for dynamic communication across object models. Thus, an OLE object cannot automatically and dynamically communicate with an object in the DOE object model. When a programmer is preparing an application program that must communicate across object models, the programmer must identify the destination objects to the ORB by declaring and defining them in an IDL method file. The IDL method file is then compiled in conjunction with run-time libraries of each object model, producing separate executable files for the client and server. This process must be repeated when a method or property of an object changes or when the application program is modified to reference new objects in a foreign or incompatible object model, for example. Thus, the ORBs only provide a static means for communicating across object models. The ORB is not capable of dynamically passing a message from one object model to an incompatible object model without prior knowledge of the method.
In OLE Automation, a subset of the OLE/COM object model from Microsoft Corporation (MS), a set of object definitions (or ODL) is compiled to create a type library or repository of object descriptions (e.g., objects and their methods and properties). Before invoking a method in an object, an OLE/Automation client object queries the library, or the library itself, to determine whether a server object can process the desired method. To do this, the object invokes the GetIDsOfNames method on the server object to determine whether the desired method is a valid method of the server object.
The GetIDsOfNames method converts text names of properties and methods into a corresponding set of dispatch identifiers (dispIDs). A dispID uniquely identifies a method or argument. It is assigned to a method or argument in an object description file that is compiled before run-time. Thus, if a method or property is added, a new dispID must be generated and compiled into the server.
If the response from the GetIDsOfNames method returns a dispID for the desired method, the client object invokes the method on the server object using the dispID to identify the method. If it is not a valid method, the client object must handle the error. If the method exists, but an error is raised during processing, the client object must handle a different error. This is awkward because it requires the application programmer to write code to handle at least two types of error messages.
Further, this process requires the client object to send two messages. When the client and server objects do not reside on the same machine, the messages must be sent across a network between the client and server objects to invoke a single method. This increases the network's message load, which is undesirable.